<?php
/**
* 身份角色
* @author darker <416319808@qq.com>
*/
namespace app\manage\controller;
use think\Request;
use app\common\model\Role as model;

class Role extends Common
{	
    public $model;  // 身份模型

    public function _initialize()
    {
        $this->model = new model();
    }
	

    public function index()
    {
        $roles = $this->model->getRolesById();
        return view('', [
            'title' => '身份角色',
            'roles' => json_encode($roles)
        ]);
    }


    public function edit()
    {
        if (request()->isAjax()) {
            $data = input('post.');
            if ($this->model->setRole($data)) {
                show(1, '设置成功');
            } else {
                show(0, '设置失败');
            }
        }
    }



}